import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
// 动态获取基础路径
function getBasePath() {
  if (window.__POWERED_BY_QIANKUN__) {
    return '/sub-app-vue2'
  }
  return '/'
}
const routes = [
  {
    path: "/page1",
    name: "Page1",
    component: () =>
      import("../views/page1.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: getBasePath(),
  routes,
});

export default router;
